

import { BaseComponent } from "../../../../extensions/cocos-scaffold-3x/assets/ui/base/BaseComponent";
import { Comp } from "../m/CompDef";
import { GpEntity } from "./GpEntity";

import { _decorator, Component, Node,Color, UITransform, UIOpacity } from 'cc';
const { ccclass, property } = _decorator;

@ccclass
export default class GpLockBullet extends BaseComponent {

    entity: GpEntity
    colorArr = [
        new Color(233, 100, 100),
        new Color(100, 233, 100),
        new Color(100, 100, 233),
    ]
    onInit(): void {
        const entity = this.node.getComponent(GpEntity)
        const ecsEntity = entity.ecsEntity
        const bullet=ecsEntity.component(Comp.Battle.Bullet)
        
        //entity.renderRoot.color = this.colorArr[(this.colorArr.length - 1) % (this.colorArr.length - 1 + bullet.forceId)]
        const size=Math.min(bullet.atp,100)
        entity.render.node.getComponent(UITransform).setContentSize(size,size)
        this.node.getComponent(UIOpacity).opacity=150
    }

    onEnable() {
    }


}
